<!DOCTYPE html >
<html xmlns:th="http://www.thymeleaf.org">

<head>
<meta charset="UTF-8">
<title>欢迎页面-X-admin2.0</title>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport"
	content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
<link rel="stylesheet" href="../static/css/back/font.css">
<link rel="stylesheet" href="../static/css/back/role.css">
<link rel="stylesheet" href="../static/css/back/xadmin.css">
<script type="text/javascript" src="../static/js/jquery-2.1.1.min.js"></script>
<script type="text/javascript" src="../static/js/jquery.md5.js"></script>
<script type="text/javascript" src="../static/js/back/xadmin.js"></script>
<!-- <script type="text/javascript" src="../static/js/back/protocol-list.js"></script> -->

<!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
<!--[if lt IE 9]>
      <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
      <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
<style type="text/css">
.layui-upload-drag.pre {
	padding: 5px !important;
}

.layui-upload-drag.pre img {
	width: 240px;
	height: 120px;
}

.layui-upload-drag+p {
	margin-top: 10px;
}

.layui-upload-list {
	text-align: -webkit-center;
}

.layui-upload {
	margin-left: 112px;
}

.shop-logo p {
	width: 240px;
}
</style>
</head>
<body>
<div class="x-nav">
      <span class="layui-breadcrumb">
        <a href="javascript:;">首页</a>
        <a href="javascript:;">系统管理</a>
        <a href="javascript:;"><cite>运营账户</cite></a>
      </span>
      <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" href="javascript:location.replace(location.href);" title="刷新">
        <i class="iconfont icon-refresh right-top-ref" ></i></a>
    </div>
	<div class="x-body">
		<form action="" method="post" class="layui-form" lay-filter="formAdd">
			<input type="hidden" name="id" value="" id="paramKey" />
			<div class="layui-form-item">
				<label for="name" class="layui-form-label">账户余额
				</label>
				<div class="layui-input-inline">
						<p  class="layui-form-mid" th:text="${#numbers.formatDecimal(oper.amount/100.0,1,2)}"></p>
				</div>
			</div>
			<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
		  <legend>账户充值</legend>
		</fieldset>
			<div class="layui-form-item">
				<label for="name" class="layui-form-label"> <span
					class="x-red">*</span>充值余额
				</label>
				<div class="layui-input-inline">
					<input type="text" id="title" name="amount" required=""
						lay-verify="required|number" autocomplete="off" class="layui-input"
						placeholder="请输入充值余额" >
				</div>
			</div>
			<div class="layui-form-item">
				<label for="name" class="layui-form-label"> <span
					class="x-red"> </span>
				</label>
				<div class="layui-input-inline">
					<button class="layui-btn" lay-submit="" lay-filter="add">充值</button>
				</div>
			</div>
		</form>
	</div>
	<script type="text/javascript" src="../static/js/back/ajax.js"></script>
	<script>
		_showData = null;
		var form = null;
		layui.use([ 'form', 'layer', 'layedit' ],function() {
							$ = layui.jquery, form = layui.form,
							layedit = layui.layedit, layer = layui.layer;
							//自定义验证规则
							form.verify({
								account : function(value) {
									if (value.length < 5) {
										return '至少填写6个字符';
									}
								},
								pass : [ /(.+){6,12}$/, '密码必须6到12位' ],
								repass : function(value) {
									if ($('#L_pass').val() != $('#L_repass')
											.val()) {
										return '两次密码不一致';
									}
								}
							});
							
							layedit.set({
					        	  uploadImage: {
					        	    url: '../sys/upload/layeditUploadPics' //接口url
					        	    ,type: 'post' //默认post
					        	  }
					        	});
					         //构建一个默认的编辑器
					         var index = layedit.build('LAY_demo1');
							
							
							//监听提交
							form.on('submit(add)', function(data) {
								$(".layui-btn").eq(1).addClass('disabled')
								console.log(data.field);
								//发异步，把数据提交给后台
							      _ajax_post_token('../sys/updateOperateInfo',{amount:Number(data.field.amount * 100)},function(res){
							      	console.log(res);
							      	if(res.resultCode == 1000){
							      	 layer.msg('操作成功!',{icon:1,time:2000});
							          // 获得frame索引

							          window.location.href = window.location.href;
							      	}else{
							      		layer.msg('操作失败!',{icon:1,time:2000});
							      		$(".layui-btn").eq(1).removeClass('disabled')
							      	}
							      });
								return false;
							});
							
							 
	});
	</script>

</body>

</html>